package com.example.mapper;

import com.example.pojo.Clazz;
import com.example.pojo.ClazzQueryParam;
import com.example.pojo.EmpQueryParam;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * ClazzMapper 类的描述信息
 *
 * @author 12427
 * @since 2025/6/3 22:28
 */
@Mapper
public interface ClazzMapper {
    /**
     * 查询所有班级
     */
//    @Select("select id, name, room, begin_date, end_date, master_id, subject, create_time, update_time from  clazz")

    List<Clazz> getAll();

    /**
     * 添加班级
     */
    @Insert("INSERT  into clazz ( name, room, begin_date, end_date, master_id, subject,create_time,update_time) " +
            " value (#{name},#{room},#{beginDate},#{endDate},#{masterId},#{subject},#{createTime},#{updateTime})")
    void insert(Clazz clazz);

    /**
     * 分页查询
     */
    List<Clazz> list(ClazzQueryParam clazzQueryParam);

    /**
     * 删除班级
     */
    @Delete("delete  from clazz where id =#{id}")
    void deletc(Integer id);


    /**
     * 根据id查询
     */
    @Select("select * from clazz where id =#{id}")
    Clazz getById(Integer id);

    /**
     * 修改班级
     */
    @Update("update clazz set name=#{name},room=#{room},begin_date=#{beginDate},end_date=#{endDate},master_id=#{masterId}," +
            "subject=#{subject} where id=#{id}")
    void update(Clazz clazz);
    //      -- 查询班级的信息, 以及班主任姓名

}
